home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 November / PCWorld_2007-11_cd.bin / domácnost a kancelar / opencontacts / setup.exe / {app} / DataSet / Templates / defaultAdvanced.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2007-08-19  |  8.1 KB  |  257 lines

  1. ∩╗┐<?xml version="1.0" encoding="UTF-8"?>
  2. <!--For advanced HTML rendering of QuickView. URL will be created for some fields.
  3. As some propietry tags are used for Open Contacts, this XSLT file should not be used for general HTML of Web.
  4. -->
  5. <xsl:stylesheet version="1.0"
  6. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  7. <xsl:output method="html" omit-xml-declaration="yes" encoding="UTF-8" />
  8.  
  9.   <xsl:template match="/">
  10.     <html>
  11.  
  12.       <body>
  13.         <xsl:for-each select="OpenContacts/Contacts/Contact">
  14.  
  15.           <table border="0" width="100%" id="table2">
  16.             <tr>
  17.               <td width="80%">
  18.                 <font face="Times New Roman" size="3">
  19.                   <b>
  20.                     <xsl:value-of select="@Name"/>
  21.                   </b>
  22.                 </font>
  23.               </td>
  24.               <td>
  25.                 <xsl:value-of select="@Title"/>
  26.               </td>
  27.             </tr>
  28.           </table>
  29.           <div style="margin-left: 15px;">
  30.  
  31.             <font size="2" color="#800000">
  32.               <xsl:apply-templates select="Notes"/>
  33.             </font>
  34.  
  35.  
  36.           </div>
  37.           <table border="0" width="100%" id="tablecompanies" cellspacing="0" cellpadding="0">
  38.             <xsl:for-each select="Companies/Company">
  39.               <tr>
  40.                 <td width="15"></td>
  41.                 <td width="80" bgcolor="#E0D601">
  42.                   <font face="Times New Roman" size="2">Company: </font>
  43.                 </td>
  44.  
  45.                 <td bgcolor="#FFFCBF">
  46.                   <font size="3">
  47.  
  48.                     <a href="idlink:{@ID}">
  49.                       <xsl:value-of select="@Name"/>
  50.                     </a>
  51.  
  52.                   </font>
  53.                     <font size="2">  <xsl:value-of select="@Relat"/> </font>
  54.                 </td>
  55.               </tr>
  56.  
  57.             </xsl:for-each>
  58.           </table>
  59.  
  60.  
  61.           <table border="0" width="100%" id="tableLinkedContacts" cellspacing="0" cellpadding="0">
  62.             <xsl:for-each select="Contacts/Contact">
  63.               <tr>
  64.                 <td width="15"></td>
  65.                 <td width="80" bgcolor="#6CE26C">
  66.                   <font face="Times New Roman" size="2">Contact: </font>
  67.                 </td>
  68.  
  69.                 <td bgcolor="#C7F3C7">
  70.                   <font size="3">
  71.  
  72.                     <a href="idlink:{@ID}">
  73.                       <xsl:value-of select="@Name"/>
  74.                     </a>
  75.  
  76.                   </font>
  77.                     <font size="2">  <xsl:value-of select="@Relat"/> </font>
  78.                 </td>
  79.               </tr>
  80.  
  81.             </xsl:for-each>
  82.           </table>
  83.  
  84.  
  85.           <table border="0" width="100%" id="tablecategories" cellspacing="0" cellpadding="0">
  86.             <xsl:for-each select="Categories/Category">
  87.               <tr>
  88.                 <td width="15"></td>
  89.                 <td width="80" bgcolor="#CCFF33">
  90.                   <font face="Times New Roman" size="2">Category: </font>
  91.                 </td>
  92.  
  93.                 <td bgcolor="#E4FF95">
  94.                   <font size="3">
  95.                     <a href="calink:{@ID}">
  96.                       <xsl:value-of select="@Name"/>
  97.                     </a>
  98.                   </font>
  99.                 </td>
  100.               </tr>
  101.  
  102.             </xsl:for-each>
  103.           </table>
  104.  
  105.           <xsl:for-each select="Sections/Section">
  106.             <div style="margin-left: 15px;">
  107.  
  108.  
  109.               <b>
  110.                 <font face="Times New Roman" size="2">
  111.                   <xsl:value-of select="@Name"/>
  112.                 </font>
  113.               </b>
  114.             </div>
  115.  
  116.  
  117.             <table border="0" width="100%" id="table1" cellspacing="0" cellpadding="0">
  118.               <xsl:for-each select="Fields/Field">
  119.                 <tr>
  120.                   <td width="15"></td>
  121.                   <td width="80" bgcolor="#C3D9FF">
  122.                     <font face="Times New Roman" size="2">
  123.                       <xsl:value-of select="@Name"/>:
  124.                     </font>
  125.                   </td>
  126.                   <td bgcolor="#E0ECFF">
  127.                     <font size="3">
  128.  
  129.                       <xsl:choose>
  130.  
  131.                         <xsl:when test="@Action='email'">
  132.  
  133.                           <a href="mailto:{@Value}">
  134.                             <xsl:value-of select="@Value"/>
  135.                           </a>
  136.                         </xsl:when>
  137.  
  138.                         <xsl:when test="@Action='web'">
  139.  
  140.                           <!--Case insensitive match is not big concern.-->
  141.                           <xsl:if test="starts-with(@Value, 'http://')">
  142.                             <a href="{@Value}">
  143.                               <xsl:value-of select="@Value"/>
  144.                             </a>
  145.                           </xsl:if>
  146.                           <xsl:if test="not(starts-with(@Value, 'http://'))">
  147.                             <a href="http://{@Value}">
  148.                               <xsl:value-of select="@Value"/>
  149.                             </a>
  150.                           </xsl:if>
  151.                         </xsl:when>
  152.  
  153.                         <xsl:when test="@Action='phone'">
  154.  
  155.                           <a href="phone:{@Value}">
  156.                             <xsl:value-of select="@Value"/>
  157.                           </a>
  158.                         </xsl:when>
  159.  
  160.  
  161.                         <xsl:when test="@Action='skype'">
  162.  
  163.                           <a href="skype:{@Value}">
  164.                             <xsl:value-of select="@Value"/>
  165.                           </a>
  166.                         </xsl:when>
  167.  
  168.                         <xsl:when test="@Action='file'">
  169.  
  170.                           <a href="local:{@Value}">
  171.                             <xsl:value-of select="@Value"/>
  172.                           </a>
  173.                         </xsl:when>
  174.  
  175.                         <xsl:when test="@Action='image'">
  176.  
  177.                           <a href="image:{@Value}">
  178.                             <xsl:value-of select="@Value"/>
  179.                           </a>
  180.                         </xsl:when>
  181.  
  182.                         <xsl:when test="@Action='person'">
  183.  
  184.                           <a href="person:{@Value}">
  185.                             <xsl:value-of select="@Value"/>
  186.                           </a>
  187.                         </xsl:when>
  188.  
  189.                         <xsl:when test="@Action='org'">
  190.  
  191.                           <a href="org:{@Value}">
  192.                             <xsl:value-of select="@Value"/>
  193.                           </a>
  194.                         </xsl:when>
  195.  
  196.                         <xsl:otherwise>
  197.                           <xsl:value-of select="@Value"/>
  198.  
  199.                         </xsl:otherwise>
  200.                       </xsl:choose>
  201.  
  202.                     </font>
  203.                   </td>
  204.                 </tr>
  205.               </xsl:for-each>
  206.  
  207.             </table>
  208.  
  209.             <div style="margin-left: 15px;">
  210.  
  211.               <font size="2" color="#800000">
  212.                 <xsl:apply-templates select="Notes"/>
  213.               </font>
  214.  
  215.             </div>
  216.  
  217.           </xsl:for-each>
  218.  
  219.           <p>  </p>
  220.  
  221.         </xsl:for-each>
  222.  
  223.       </body>
  224.     </html>
  225.   </xsl:template>
  226.   
  227.   
  228.   <xsl:template match="Notes">
  229.       <xsl:call-template name="substitute">
  230.          <xsl:with-param name="string" select="." />
  231.       </xsl:call-template>
  232. </xsl:template>
  233.  
  234.  <xsl:template name="substitute">
  235.    <xsl:param name="string" />
  236.    <xsl:param name="from" select="' '" />
  237.    <xsl:param name="to">
  238.       <p/>
  239.    </xsl:param>
  240.    <xsl:choose>
  241.       <xsl:when test="contains($string, $from)">
  242.          <xsl:value-of select="substring-before($string, $from)" />
  243.          <xsl:copy-of select="$to" />
  244.          <xsl:call-template name="substitute">
  245.             <xsl:with-param name="string"
  246.                             select="substring-after($string, $from)" />
  247.             <xsl:with-param name="from" select="$from" />
  248.             <xsl:with-param name="to" select="$to" />
  249.          </xsl:call-template>
  250.       </xsl:when>
  251.       <xsl:otherwise>
  252.          <xsl:value-of select="$string" />
  253.       </xsl:otherwise>
  254.    </xsl:choose>
  255. </xsl:template>                
  256.  
  257. </xsl:stylesheet>